//
//  NoticeCell.m
//  掌上海印
//
//  Created by 陈德锋 on 16/4/17.
//  Copyright © 2016年 handsome. All rights reserved.
//

#import "NoticeCell.h"

@implementation NoticeCell

+ (instancetype)NoticeCellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"NoticeCell";
    NoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[NoticeCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _title = [[UILabel alloc] init];
        [self.contentView addSubview: _title];
        
        _time = [[UILabel alloc] init];
        [self.contentView addSubview: _time];
        
        _depetment = [[UILabel alloc] init];
        [self.contentView addSubview:_depetment];
        
        
    }
    return self;
}

-(void) layoutSubviews {
    [super layoutSubviews];
    _title.frame = CGRectMake(10, 0, [[UIScreen mainScreen] bounds].size.width -20, 35);
//    _title.text = @"黄海成王八蛋贪污受贿！";
    _title.font = [UIFont systemFontOfSize:16.0];
    
    _depetment.frame = CGRectMake(15, 40, 60, 15);
//    _depetment.text = @"工程院";
    _depetment.font = [UIFont systemFontOfSize:12.0];
    _depetment.textColor= [UIColor grayColor];
    
    _time.frame = CGRectMake([[UIScreen mainScreen]bounds].size.width-100, 45, 90, 15);
//    _time.text = @"04-17 21:50";
    _time.font = [UIFont systemFontOfSize:12.0];
    _time.textColor= [UIColor grayColor];

    
}

-(void) setInderow:(IndexRow *)inderow
{
    _inderow = inderow;
    if (_inderow) {
        self.title.text = _inderow.title;
        self.time.text = _inderow.time;
        self.depetment.text = _inderow.depetment;

    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
